#include "stdafx.h"
#include "util.h"

DWORD GetFeCoreDllPath(LPWSTR lpFilepath, DWORD nSize)
{
	DWORD dwSize;

	dwSize = GetModuleFileName(0, lpFilepath, nSize);
	while(dwSize > 0 && lpFilepath[dwSize - 1] != '\\')
	{
		dwSize--;
	}
	lpFilepath[dwSize] = 0;

	return dwSize;
}

RECT GetScreenRect(HWND hWnd)
{
	MONITORINFO info;
	info.cbSize = sizeof(info);

	GetMonitorInfo(MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY),
		&info);

	return info.rcMonitor;
}

VOID ShowSplashWindow(HWND hWnd)
{
	RECT rect = GetScreenRect(hWnd);
	SetWindowPos(
		hWnd,
		HWND_TOPMOST,
		rect.left,
		rect.top,
		rect.right - rect.left,
		rect.bottom - rect.top,
		SWP_SHOWWINDOW);

	SHFullScreen(hWnd, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON | SHFS_HIDESTARTICON);
    DisableTaskbar();
}

VOID DisableTaskbar(VOID) {
	if (true) // TODO !win_mobile
	{
		HWND handle = FindWindow(L"HHTaskBar", L"");
		if (handle) {
			ShowWindow(handle, 0);
			EnableWindow(handle, false);
		}
	}
}

VOID EnableTaskbar(VOID) {
	if (true) // TODO !win_mobile
	{
		HWND handle = FindWindow(L"HHTaskBar", L"");
        if (handle) {
            ShowWindow(handle, 1);
            EnableWindow(handle, true);
        }
	}
}
